<!DOCTYPE html>
<html>
<head>
    <title>趣单词</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimal-ui, minimum-scale=1.0, maximum-scale=1.0">
    <style>
    body{margin:0px;}
    .head{
    text-align: center;
    height: 45px;
    background: #555;
    line-height: 45px;
    color: #fff;
    font-size: 20px;
    }
    .dc_s{
    text-align: center;
    margin-top: 188px;
    }
    .hd-input{padding: 8px;width: 68%;}
    .s_btn{padding: 7px;}
    .dc_rs{
    width: 88%;
    margin: 0 auto;
    }
    .dc_box{
        margin: 10px;
    }
    </style>
</head>
<body>
    
<?php
$dc = $_GET['dc'];
if ($dc == "") {
?>
<div class="head">趣单词</div>

<div class="dc_s">
<form autocomplete="off" action="/danci/" method="get" accept-charset="utf-8">
        <input type="text" class="hd-input" value="love" name="dc" id="gNewSearch" autocomplete="off" style="">
        <input type="hidden" value="1" name="box">
        <input type="submit" id="su" value="查询" class="s_btn">
</form>
</div>

<div class="dc_rs">
<h3>热搜:</h3>
<ul>
<li>
<a href="/danci/?dc=love">love</a>
</li>

<li>
<a href="/danci/?dc=Search">Search</a>
</li>

<li>
<a href="/danci/?dc=regret">regret</a>
</li>

<li>
<a href="/danci/?dc=Hello">Hello</a>
</li>

<li>
<a href="/danci/?dc=Japan">Japan</a>
</li>


</ul>
    
</div>


<?php } else { 
$result = file_get_contents("http://dict.youdao.com/suggest?q=".$dc."&num=1&doctype=json");
$json = json_decode($result,true);
echo '<div class="head">'.$dc.'的意思</div>';

echo '<div class="dc_box">';

if($json['result']['code']=200){
echo '<p>'.$dc.'单词---->已解析成功...</p>';
echo '<hr/><div>单词解释:</div>';
echo '<p>'.$json['data']['entries'][0]['explain'].'</p>';
}else {
echo '我大哥说没有找到你要找的东西，你是不是乱输入东西了...';
}
echo '</div>';

}
?>
<div class="cc"><a href="javascript:history.back();"><i class="comiis_font">< 返回</i></a></div>
</body>
</html>